import { ErrorInterface, SuccessInterface } from "../../config/Interfaces/Helper/response.helper.interface"; /** * The DeleteOperation class is used to delete a document from a collection. * This class provides methods to delete a single document that matches the base query. */ export default class DeleteOperation { protected readonly collectionName: string; private readonly baseQuery; private readonly path; private readonly ResponseHelper; private allDataWithFileName; private sort; constructor(collectionName: string, path: string, baseQuery: object | any); /** * Deletes a single document that matches the base query. * * Routed through a single-operation Transaction, so the delete is WAL-backed: * locking, the fresh re-read under lock, and index sync are all handled by * Transaction/TransactionIndexManager. This method's own job is just picking * *which* document to target (honoring .Sort()), since Transaction.delete() * removes every document a query matches. * * @returns {Promise} A response object containing either: * - Success: { message: "Data deleted successfully", deleteData: object } * - Error: An error message if no data found or deletion fails */ deleteOne(): Promise; /** * Deletes multiple documents that match the base query. * * Routed through a single Transaction covering the whole query, so the batch * is WAL-backed: locking, fresh re-reads, and index sync (one rewrite per * affected index field, not one per document) are all handled by * Transaction/TransactionIndexManager. * * @returns {Promise} A promise that resolves to either: * - Success with a success message and the deleted data * - Error if no matching data is found or the transaction failed */ deleteMany(): Promise; /** * to be sorted to the query * @param {object} sort - The sort to be set. * @returns {DeleteOperation} - An instance of the DeleteOperation class. */ Sort(sort: object | any): DeleteOperation; /** * Resolves the single document deleteOne should target: runs the same * index-or-full-scan search deleteMany's Transaction path uses internally, * then applies .Sort() (if set) and picks the first match - matching the * "one specific document" semantics deleteOne has always had. * * @returns The target document's ID, or null if nothing matched. */ private resolveTargetDocumentId; /** * Loads all buffer raw data from the specified directory. * * @returns {Promise} A promise that resolves to a success or error response. */ private LoadAllBufferRawData; }